import request from "/@/utils/request"

//获取试题列表
export function testList(query?: Object) {
  return request({
    url: '/train/tkglQuestionList/page',
    method: 'get',
    params: query
  })
}
//获取证书
export function getZsglCertificateList(query?: Object) {
  return request({
    url: '/train/zsglCertificateTemplate/getZsglCertificateList',
    method: 'get',
    params: query
  })
}
//通过examId查询考试
export function getListForH5ById(examId?: string) {
  return request({
    url: '/train/ksglExamList/getListForH5ById/' + examId,
    method: 'get'
  })
}
//通过id删除
export function deleteExam(id?: string) {
  return request({
    url: '/train/ksglExamList/deleteExamById/' + id,
    method: 'post'
  })
}
//关键点
export function getKeyPointListByZymcIds(obj?: Object) {
  return request({
    url: '/train/jnglKeyPoints/getKeyPointListByZymcIds',
    method: 'post',
    data: obj
  })
}
//通过id查询随机组卷试题
export function getexamInfoId(query?: Object) {
  return request({
    url: '/train/ksglExamInfo/examInfoId',
    method: 'get',
    params: query
  })
}
//通过id查询非随机组卷试题
export function getOptionalQuestion(query?: Object) {
  return request({
    url: '/train/ksglChooseQuestionList/getOptionalQuestion',
    method: 'get',
    params: query
  })
}
//保存随机组卷试题
export function submit(obj?: Object) {
  return request({
    url: '/train/ksglExamInfo',
    method: 'post',
    data: obj
  })
}
//保存非随机组卷试题
export function submitChoose(obj?: Object) {
  return request({
    url: '/train/ksglChooseQuestionList/saveExamInfo',
    method: 'post',
    data: obj
  })
}
//编辑试题
export function edit(obj?: Object) {
  return request({
    url: '/train/ksglExamInfo',
    method: 'put',
    data: obj
  })
}
//题数
export function problemsNumberCheck(obj?: Object) {
  return request({
    url: '/train/ksglExamInfo/checkQuestionCount',
    method: 'post',
    data: obj
  })
}
//题数
export function problemsNumber(obj?: Object) {
  return request({
    url: '/train/tkglQuestionList/questionCount',
    method: 'post',
    data: obj
  })
}
//参考人员
// export function getUsers(pkPosts: string[]) {
//   return request('/admin/syspost/users/pkposts', {
//     params: {
//       pkPosts: pkPosts // axios 将自动处理数组，将其转换为可读的查询字符串格式
//     }
//   });
// }
//刪除
export function removeChild(query?: string) {
  return request({
    url: '/train/ksglExamInfo/removeChild?'+ query,
    method: 'get'
  })
}
export function getUsers(query?: Object) {
  return request({
    url: '/admin/syspost/users/pkposts?'+ query,
    method: 'get'
  })
}
//分数集合
export function score(examId?: string) {
  return request({
    url: '/train/ksglScoreLevel/getList/' + examId,
    method: 'get'
  })
}
// export function fetchList(query?: Object) {
//   return request({
//     url: '/train/ksglExamList/page',
//     method: 'get',
//     params: query
//   })
// }
export function fetchList(query?: Object) {
  return request({
    url: '/train/ksglExamList/getListForH5',
    method: 'get',
    params: query
  })
}
export function addObj(obj?: Object) {
  return request({
    url: '/train/ksglExamList',
    method: 'post',
    data: obj
  })
}

export function getObj(id?: string) {
  return request({
    url: '/train/ksglExamList/' + id,
    method: 'get'
  })
}

export function delObjs(ids?: Object) {
  return request({
    url: '/train/ksglExamList',
    method: 'delete',
    data: ids
  })
}

export function putObj(obj?: Object) {
  return request({
    url: '/train/ksglExamList',
    method: 'put',
    data: obj
  })
}

export function delChildObjs(ids?: Object) {
  return request({
    url: '/train/ksglExamInfo/child',
    method: 'delete',
    data: ids
  })
}